package com.hangzhou.xyj.net.request;

import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.hangzhou.xyj.net.request.base.BaseRequest;
import com.hangzhou.xyj.utils.constants.API;

/**
 * Created by yaohuix on 2016/3/14  18:11
 * <p/>
 * 说明：唱戏-根据条件查询
 */
public class GetSingByConditionReq extends BaseRequest {

    public enum EParmType {
        TYPE_BY_USER_ID, TYPE_BY_CAT_ID;
    }

    /**
     * 构造方法
     *
     * @param eParmType
     * @return
     * @author yaohuix
     * @date 2016/3/14 18:13
     */
    public GetSingByConditionReq(EParmType eParmType, int paramTypeValue, int currentPage, int pageSize) {
        JsonObject jsonObject = new JsonObject();
        switch (eParmType) {
            case TYPE_BY_CAT_ID:
                jsonObject.addProperty("catId", paramTypeValue);
                break;
            case TYPE_BY_USER_ID:
            default:
                jsonObject.addProperty("userId", paramTypeValue);
                break;
        }
//        jsonObject.addProperty("userId", paramTypeValue);
        jsonObject.addProperty("currentPage", currentPage);
        jsonObject.addProperty("pageSize", pageSize);
        String jsonStr = new Gson().toJson(jsonObject);
        add("data", jsonStr);
    }


    @Override
    public String getUrl() {
        return API.GET_SING_BY_CONDITION;
    }
}
